cmake_minimum_required(VERSION 3.22.1)

get_filename_component(example_name ${CMAKE_CURRENT_LIST_DIR} NAME)

project(${example_name})

# Aggregate dependencies
set(required_components gui)
set(required_libraries dart dart-gui)

if(DART_IN_SOURCE_BUILD)
  dart_build_example_in_source(${example_name} LINK_LIBRARIES ${required_libraries})
  return()
endif()

find_package(DART 6.15.0 REQUIRED COMPONENTS ${required_components} CONFIG)
find_package(CLI11 2.4 CONFIG REQUIRED)

file(GLOB srcs "*.cpp" "*.hpp")
add_executable(${example_name} ${srcs})
target_link_libraries(${example_name} PUBLIC ${required_libraries} CLI11::CLI11)
target_include_directories(${example_name} PUBLIC ${DART_INCLUDE_DIRS})
